package com.example.nacosdemo.nacosconfcontroller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * spring-cloud demo
 * **/
@RefreshScope
@RestController
@RequestMapping("api/v1/config")
public class ConfigCloudController {

    @Value("${useLocalCache:false}")
    private boolean useLocalCache;

    @Value("${demo:NULL}")
    private String demo;

    @RequestMapping(value = "/cloud/get/value",method = RequestMethod.GET)
    public Boolean getValue(){
        return useLocalCache;
    }
    @RequestMapping(value = "/cloud/get/value/{path}/",method = RequestMethod.GET)
    public String getValue(@PathVariable(value = "path") String path){
        return demo;
    }
}
